document.querySelector(".orders-all").onclick= function(event){
  var ele = event.target;
  var  count = 0;
  var total = 0;

 var selectCountArr = document.querySelectorAll(".film-area .select");
 selectCountArr.onclick = function (){}
 for (var i = 0;i<selectCountArr.length;i++){
     if (selectCountArr[i].checked&&(selectCountArr[i].parentElement.lastElementChild.firstElementChild.children[1].firstElementChild.lastElementChild.innerText!='待观影')){
     count++;
     total+=parseFloat(selectCountArr[i].parentElement.lastElementChild.firstElementChild.children[2].firstElementChild.children[1].innerText);
     }
 }
    total=total.toFixed(1);
    ele.parentElement.parentElement.parentElement.nextElementSibling.firstElementChild.children[1].innerText=count;
    ele.parentElement.parentElement.parentElement.nextElementSibling.children[1].innerText=total;
}

document.querySelector(".select-list").onclick = function (event){
    var ele = event.target;
    console.log(ele.nodeName);
    console.log(ele.id);
    if (ele.nodeName=="LI"){
        var Lists = ele.parentElement.children;
        for (var i = 0; i <Lists.length ; i++) {
            Lists[i].classList.remove("selected");
        }
        ele.classList.add("selected");
    }else{
        var List1 = ele.parentElement.parentElement.children;
        for ( var a = 0; a <List1.length ; a++) {
            List1[a].classList.remove("selected");
        }
        ele.parentElement.classList.add("selected");
    }
}

//------------------------------根据不同的订单状态，选择不同的详情页面-------------------------------------------------
    var DetailUrl = document.querySelectorAll(".film-area .Durl");
    console.log(DetailUrl);
    console.log(DetailUrl.href);
for (var i = 0;i<DetailUrl.length;i++) {
    var status = DetailUrl[i].parentElement.parentElement.parentElement.children[1].firstElementChild.lastElementChild.innerHTML;
    if (status == "待观影") {
        DetailUrl[i].href = "../order_details/wait_watch_detail.html";
        console.log("待观影" + DetailUrl[i].href);
    } else if (status == "待支付") {
        DetailUrl[i].href = "../order_details/wait_pay_detail.html";
        console.log(DetailUrl[i].href);
    } else{
        DetailUrl[i].href = "../order_details/has_watched_detail.html";
        console.log(DetailUrl[i].href);
    }
}
//----------------------------删除订单-----------------------------------------------
var selects = document.querySelectorAll(".film-area .select");
var ul = document.querySelector(".films");
var list = ul.querySelectorAll("li");
var delete1 = document.querySelector(".delete");
for (var i = 0; i < list.length ; i++) {
    console.log(list[i].innerText);
    if (selects[i].checked&&delete1.onclick){
       list[i].remove();
       console.log(i);
    }
}



